home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / magicheaven.swf / scripts / frame_19 / DoAction.as
Text File  |  2007-10-01  |  74KB  |  2,809 lines

  1. function bibi()
  2. {
  3.    bg.santa.gotoAndStop("hit");
  4. }
  5. function func()
  6. {
  7.    bg.santa.boss.gotoAndPlay(2);
  8.    trace("dadadadadada");
  9.    bg.santa.gotoAndStop("hit");
  10. }
  11. function func_2()
  12. {
  13.    bb--;
  14.    adjust_wudi(_root.game_ui);
  15.    if(bb <= 5 && bb >= 0)
  16.    {
  17.       bg.santa.boss.gotoAndPlay("boss");
  18.       trace("ooooooooooooooo");
  19.       bg.santa.to_die1();
  20.    }
  21.    else
  22.    {
  23.       bb = 0;
  24.    }
  25.    trace("bb=======" + bb);
  26. }
  27. function adjust_wudi(where)
  28. {
  29.    where.wudi.gotoAndStop(bb + 1);
  30. }
  31. function next_game()
  32. {
  33.    game_paused = true;
  34.    this.attachMovie("next_stage","next_stage",3);
  35. }
  36. function next_round()
  37. {
  38.    if(game_time > 0 and game_life > 0)
  39.    {
  40.       if(game_stage < 5)
  41.       {
  42.          game_stage++;
  43.       }
  44.       else
  45.       {
  46.          game_level++;
  47.          game_stage = 1;
  48.       }
  49.       trace("game_level    " + game_level + "   " + game_stage);
  50.       if(game_level <= 4)
  51.       {
  52.          _root.gotoAndStop("initial");
  53.       }
  54.       else
  55.       {
  56.          win_game();
  57.       }
  58.       if(game_level <= 4)
  59.       {
  60.          play_music("music_bg" + game_level,true);
  61.       }
  62.    }
  63.    else
  64.    {
  65.       lose_game();
  66.    }
  67. }
  68. function create_stage()
  69. {
  70.    bg.removeMovieClip();
  71.    game_ui.removeMovieClip();
  72.    var _loc2_ = this.attachMovie("bg","bg",1);
  73.    _loc2_.bg.gotoAndStop(game_level);
  74.    _loc2_.step.gotoAndStop((game_level - 1) * 5 + game_stage);
  75.    mission_end_count = 100;
  76.    var _loc3_ = this.attachMovie("Ui_infer","game_ui",2);
  77.    gotoAndStop("gaming");
  78. }
  79. function create_monsters(type, x, y)
  80. {
  81.    var _loc3_ = this.bg.getNextHighestDepth();
  82.    var _loc4_ = this.bg.createEmptyMovieClip("snow_shine" + _loc3_,_loc3_);
  83.    _loc4_._x = x;
  84.    _loc4_._y = y - 20;
  85.    var i = 1;
  86.    while(i <= 4)
  87.    {
  88.       var _loc5_ = _loc4_.attachMovie("snow","snow" + i,i);
  89.       _loc5_.gotoAndStop(4);
  90.       _loc5_.angle = i * 90 * 0.01745;
  91.       _loc5_._x = 30 * Math.sin(_loc5_.angle);
  92.       _loc5_._y = 30 * Math.cos(_loc5_.angle);
  93.       i++;
  94.    }
  95.    _loc4_.distance = 30;
  96.    _loc4_.onEnterFrame = function()
  97.    {
  98.       if(!_root.game_paused)
  99.       {
  100.          this.distance -= 2;
  101.          for(i in this)
  102.          {
  103.             this[i]._rotation += 20;
  104.             this[i]._x = this.distance * Math.sin(this[i].angle);
  105.             this[i]._y = this.distance * Math.cos(this[i].angle);
  106.          }
  107.          if(this.distance == 10)
  108.          {
  109.             var _loc4_ = this._parent.getNextHighestDepth();
  110.             var monster_mc = this._parent.attachMovie("monster" + type,"monster_" + type + "_" + _loc4_,_loc4_);
  111.             monster_mc._x = this._x;
  112.             monster_mc._y = this._y + 20;
  113.             monster_mc.swapDepths(this);
  114.             monster_mc.stop();
  115.             monster_mc.mc.stop();
  116.             monster_mc.count = 0;
  117.             monster_mc._xscale = 2.5;
  118.             monster_mc._yscale = 2.5;
  119.             monster_mc.type = type;
  120.             var _loc3_ = new Color(monster_mc);
  121.             _loc3_.setTransform(shine_Transform2);
  122.             if(this.cross_step != undefined)
  123.             {
  124.                monster_mc.cross_step = this.cross_step;
  125.             }
  126.             monster_mc.onEnterFrame = function()
  127.             {
  128.                if(!_root.game_paused)
  129.                {
  130.                   this.count += 2;
  131.                   monster_mc._xscale = 2.5 * this.count;
  132.                   monster_mc._yscale = 2.5 * this.count;
  133.                   if(this.count == 40)
  134.                   {
  135.                      var _loc3_ = new Color(this);
  136.                      _loc3_.setTransform(_root.shine_Transform1);
  137.                      this.mc.play();
  138.                      delete this.onEnterFrame;
  139.                      if(this.typ == "land")
  140.                      {
  141.                         land_monsterAI(this);
  142.                      }
  143.                      else if(this.typ == "fly")
  144.                      {
  145.                         fly_monsterAI(this);
  146.                      }
  147.                      else
  148.                      {
  149.                         _root["bossAI" + game_level](this);
  150.                      }
  151.                   }
  152.                }
  153.             };
  154.          }
  155.          else if(this.distance < 0)
  156.          {
  157.             this._alpha = Math.round((40 + this.distance) / 40 * 100);
  158.             if(this.distance == -10)
  159.             {
  160.                for(i in this)
  161.                {
  162.                   this[i].gotoAndStop(3);
  163.                }
  164.             }
  165.             else if(this.distance == -20)
  166.             {
  167.                for(i in this)
  168.                {
  169.                   this[i].gotoAndStop(2);
  170.                }
  171.             }
  172.             else if(this.distance == -30)
  173.             {
  174.                for(i in this)
  175.                {
  176.                   this[i].gotoAndStop(1);
  177.                }
  178.             }
  179.             else if(this.distance == -40)
  180.             {
  181.                this.removeMovieClip();
  182.             }
  183.          }
  184.       }
  185.    };
  186.    return _loc4_;
  187. }
  188. function create_big_snow(where, what, small, large)
  189. {
  190.    this.bg.hit_snow.removeMovieClip();
  191.    var _loc7_ = this.bg.getNextHighestDepth();
  192.    var _loc5_ = this.bg.createEmptyMovieClip("hit_snow" + _loc7_,_loc7_);
  193.    _loc5_._x = where._x;
  194.    _loc5_._y = where._y;
  195.    _loc5_.distance = small;
  196.    var i = 1;
  197.    while(i <= 4)
  198.    {
  199.       var _loc3_ = _loc5_.attachMovie("snow","snow" + i,i);
  200.       _loc3_.gotoAndStop(what);
  201.       _loc3_.angle = i * 90 * 0.01745;
  202.       _loc3_._x = small * Math.sin(_loc3_.angle);
  203.       _loc3_._y = small * Math.cos(_loc3_.angle);
  204.       i++;
  205.    }
  206.    _loc5_.onEnterFrame = function()
  207.    {
  208.       if(!_root.game_paused)
  209.       {
  210.          for(i in this)
  211.          {
  212.             this[i]._rotation += 20;
  213.             this[i]._x = this.distance * Math.sin(this[i].angle);
  214.             this[i]._y = this.distance * Math.cos(this[i].angle);
  215.          }
  216.          this._alpha = Math.round((1 - this.distance / large) * 100);
  217.          this.distance += 3;
  218.          if(this.distance > large)
  219.          {
  220.             for(i in this)
  221.             {
  222.                this[i].removeMovieClip();
  223.             }
  224.             if(this.myMission != undefined)
  225.             {
  226.                this.onEnterFrame = function()
  227.                {
  228.                   if(!_root.game_paused)
  229.                   {
  230.                      if(--mission_end_count < 0)
  231.                      {
  232.                         this.myMission();
  233.                         this.removeMovieClip();
  234.                      }
  235.                   }
  236.                };
  237.             }
  238.             else
  239.             {
  240.                this.removeMovieClip();
  241.             }
  242.          }
  243.       }
  244.    };
  245.    return _loc5_;
  246. }
  247. function create_land_snow(where)
  248. {
  249.    var _loc1_ = bg.getNextHighestDepth();
  250.    var _loc2_ = bg.attachMovie("land_snow","land_snow" + _loc1_,_loc1_);
  251.    _loc2_._x = where._x;
  252.    _loc2_._y = where._y;
  253. }
  254. function snow_down(where)
  255. {
  256.    where.wind_dir = 1;
  257.    var _loc4_ = 0;
  258.    while(_loc4_ <= 25)
  259.    {
  260.       var _loc3_ = where.getNextHighestDepth();
  261.       var _loc2_ = where.attachMovie("snow","snow" + _loc3_,_loc3_);
  262.       _loc2_.speed = random(3) + 3;
  263.       _loc2_._x = random(600) - 50;
  264.       _loc2_._y = random(400);
  265.       _loc2_.gotoAndStop(random(4) + 1);
  266.       _loc2_.onEnterFrame = function()
  267.       {
  268.          this._x += 1;
  269.          this._y += this.speed;
  270.          this._rotation += this.speed;
  271.          if(this._x > 580 or this._y > 420)
  272.          {
  273.             this.gotoAndStop(random(4) + 1);
  274.             this.speed = random(3) + 3;
  275.             this._x = random(600) - 50;
  276.             this._y = - random(-100);
  277.          }
  278.       };
  279.       _loc4_ = _loc4_ + 1;
  280.    }
  281. }
  282. function add_presents(where, typ, num)
  283. {
  284.    var _loc5_ = bg.getNextHighestDepth();
  285.    var _loc3_ = bg.attachMovie("presents","presents" + _loc5_,_loc5_);
  286.    _loc3_.living = true;
  287.    _loc3_.typ = typ;
  288.    _loc3_._x = Math.round(where._x);
  289.    _loc3_._y = Math.round(where._y);
  290.    _loc3_.special_array = ["power","range","life","speed","cchest"];
  291.    _loc3_.come_out = function()
  292.    {
  293.       if(typ == "fromChest")
  294.       {
  295.          this.typ = "presents";
  296.          this.gotoAndStop(num);
  297.       }
  298.       else if(typ == "presents" and random(3))
  299.       {
  300.          this.gotoAndStop(num);
  301.       }
  302.       else
  303.       {
  304.          this.typ = this.special_array[random(5)];
  305.          this.gotoAndStop(this.typ);
  306.       }
  307.       play_sound("present_out");
  308.       var xspeed = random(20) - random(20);
  309.       this.onEnterFrame = function()
  310.       {
  311.          if(!_root.game_paused)
  312.          {
  313.             moveAction(this,xspeed,-11 - random(this._y / 35));
  314.             if(this.states == "stand")
  315.             {
  316.                this.find_player();
  317.                if(this.typ == "cchest")
  318.                {
  319.                   this.health = 10;
  320.                   this.to_die = function()
  321.                   {
  322.                      if(this.health > 0)
  323.                      {
  324.                         this.gotoAndStop("ochest");
  325.                         this.health = this.health - 1;
  326.                         if(this.health > 0)
  327.                         {
  328.                            add_presents(this,"fromChest",random(10) + 1);
  329.                         }
  330.                         else
  331.                         {
  332.                            this.onEnterFrame = function()
  333.                            {
  334.                               if(!_root.game_paused)
  335.                               {
  336.                                  this._alpha -= 5;
  337.                                  if(this._alpha < 5)
  338.                                  {
  339.                                     this.removeMovieClip();
  340.                                  }
  341.                               }
  342.                            };
  343.                         }
  344.                      }
  345.                   };
  346.                }
  347.             }
  348.          }
  349.       };
  350.    };
  351.    _loc3_.find_player = function()
  352.    {
  353.       this.exist_count = 0;
  354.       this.find_count = 0;
  355.       this.onEnterFrame = function()
  356.       {
  357.          if(!_root.game_paused)
  358.          {
  359.             if(++this.exist_count > 80)
  360.             {
  361.                var _loc3_ = this.exist_count % 2;
  362.                if(_loc3_)
  363.                {
  364.                   this._alpha = 50;
  365.                }
  366.                else
  367.                {
  368.                   this._alpha = 100;
  369.                }
  370.                if(this.exist_count > 130)
  371.                {
  372.                   this.removeMovieClip();
  373.                }
  374.             }
  375.             if(this.hitTest(bg.santa.g))
  376.             {
  377.                this._alpha = 100;
  378.                if(this.typ == "presents")
  379.                {
  380.                   game_score += Number(this.score);
  381.                   adjust_score(_root.game_ui);
  382.                   this.gotoAndStop("score");
  383.                   play_sound("bonus_sound");
  384.                }
  385.                else if(this.typ == "power")
  386.                {
  387.                   if(game_power < 2)
  388.                   {
  389.                      game_power = 2;
  390.                      this.gotoAndStop(this.typ + "_out");
  391.                      play_sound("upgrade");
  392.                   }
  393.                   else
  394.                   {
  395.                      game_score += Number(this.score);
  396.                      adjust_score(_root.game_ui);
  397.                      this.gotoAndStop("score");
  398.                      play_sound("bonus_sound");
  399.                   }
  400.                }
  401.                else if(this.typ == "range")
  402.                {
  403.                   if(game_range < 20)
  404.                   {
  405.                      game_range = 20;
  406.                      this.gotoAndStop(this.typ + "_out");
  407.                      play_sound("upgrade");
  408.                   }
  409.                   else
  410.                   {
  411.                      game_score += Number(this.score);
  412.                      adjust_score(_root.game_ui);
  413.                      this.gotoAndStop("score");
  414.                      play_sound("bonus_sound");
  415.                   }
  416.                }
  417.                else if(this.typ == "life")
  418.                {
  419.                   if(game_life < 10)
  420.                   {
  421.                      game_life++;
  422.                      adjust_life(_root.game_ui);
  423.                      this.gotoAndStop(this.typ + "_out");
  424.                      play_sound("upgrade");
  425.                   }
  426.                   else
  427.                   {
  428.                      game_score += Number(this.score);
  429.                      adjust_score(_root.game_ui);
  430.                      this.gotoAndStop("score");
  431.                      play_sound("bonus_sound");
  432.                   }
  433.                }
  434.                else if(this.typ == "speed")
  435.                {
  436.                   if(game_speed < 6)
  437.                   {
  438.                      game_speed = 6;
  439.                      this.gotoAndStop(this.typ + "_out");
  440.                      play_sound("upgrade");
  441.                   }
  442.                   else
  443.                   {
  444.                      game_score += Number(this.score);
  445.                      adjust_score(_root.game_ui);
  446.                      this.gotoAndStop("score");
  447.                      play_sound("bonus_sound");
  448.                   }
  449.                }
  450.                else if(this.typ == "cchest")
  451.                {
  452.                   game_score += Number(this.score);
  453.                   adjust_score(_root.game_ui);
  454.                   this.gotoAndStop("score");
  455.                   play_sound("bonus_sound");
  456.                }
  457.                this._x = bg.santa._x;
  458.                this.onEnterFrame = function()
  459.                {
  460.                   if(!_root.game_paused)
  461.                   {
  462.                      this._y -= 2;
  463.                      if(++this.find_count == 20)
  464.                      {
  465.                         this.removeMovieClip();
  466.                      }
  467.                   }
  468.                };
  469.             }
  470.          }
  471.       };
  472.    };
  473.    _loc3_.show_score = function(which)
  474.    {
  475.       var _loc3_ = 100000 + this.score;
  476.       var _loc4_ = this.score.toString().length;
  477.       if(which > _loc4_)
  478.       {
  479.          this["num" + which]._visible = 0;
  480.       }
  481.       else
  482.       {
  483.          var _loc5_ = Number(_loc3_.toString().slice(6 - which,7 - which));
  484.          this["num" + which].gotoAndStop(_loc5_ + 1);
  485.       }
  486.    };
  487.    _loc3_.come_out();
  488.    return _loc3_;
  489. }
  490. function adjust_life(where)
  491. {
  492.    if(game_life > 10)
  493.    {
  494.       where.life.gotoAndStop(10);
  495.    }
  496.    else if(game_life > 0 and game_life <= 10)
  497.    {
  498.       where.life.gotoAndStop(game_life);
  499.    }
  500.    else
  501.    {
  502.       where.life._visible = 0;
  503.    }
  504. }
  505. function adjust_score(where)
  506. {
  507.    var _loc1_ = 100000000 + game_score;
  508.    var _loc10_ = Number(_loc1_.toString().slice(8,9)) + 1;
  509.    var _loc3_ = Number(_loc1_.toString().slice(7,8)) + 1;
  510.    var _loc4_ = Number(_loc1_.toString().slice(6,7)) + 1;
  511.    var _loc5_ = Number(_loc1_.toString().slice(5,6)) + 1;
  512.    var _loc6_ = Number(_loc1_.toString().slice(4,5)) + 1;
  513.    var _loc7_ = Number(_loc1_.toString().slice(3,4)) + 1;
  514.    var _loc8_ = Number(_loc1_.toString().slice(2,3)) + 1;
  515.    var _loc9_ = Number(_loc1_.toString().slice(1,2)) + 1;
  516.    where.num1.gotoAndStop(_loc10_);
  517.    where.num10.gotoAndStop(_loc3_);
  518.    where.num100.gotoAndStop(_loc4_);
  519.    where.num1000.gotoAndStop(_loc5_);
  520.    where.num10000.gotoAndStop(_loc6_);
  521.    where.num100000.gotoAndStop(_loc7_);
  522.    where.num1000000.gotoAndStop(_loc8_);
  523.    where.num10000000.gotoAndStop(_loc9_);
  524. }
  525. function adjust_boss(where)
  526. {
  527.    if(game_stage <= 4)
  528.    {
  529.       where.boss.swapDepths(1000);
  530.       where.boss.removeMovieClip();
  531.    }
  532.    else
  533.    {
  534.       var _loc3_ = this["game_boss" + game_level + "_health"];
  535.       if(_loc3_ > 0)
  536.       {
  537.          where.boss.gotoAndStop(this["game_boss" + game_level + "_health"]);
  538.       }
  539.       else
  540.       {
  541.          where.boss._visible = 0;
  542.       }
  543.    }
  544. }
  545. function adjust_time(where)
  546. {
  547.    if(game_stage <= 4)
  548.    {
  549.       game_time = 60;
  550.    }
  551.    else
  552.    {
  553.       game_time = 99;
  554.    }
  555.    where.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
  556.    where.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
  557.    where.time_count = 0;
  558.    where.onEnterFrame = function()
  559.    {
  560.       if(!_root.game_paused)
  561.       {
  562.          if(monsters_exist > 0)
  563.          {
  564.             if(++this.time_count == 80)
  565.             {
  566.                this.time_count = 0;
  567.                if(game_time > 0)
  568.                {
  569.                   game_time--;
  570.                   if(game_time >= 0)
  571.                   {
  572.                      this.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
  573.                      this.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
  574.                   }
  575.                   if(game_time == 0)
  576.                   {
  577.                      create_big_snow(bg.santa,4,8,100);
  578.                      bg.santa.gotoAndStop("hit");
  579.                      bg.santa.onEnterFrame = function()
  580.                      {
  581.                         if(!_root.game_paused)
  582.                         {
  583.                            this._alpha -= 1;
  584.                            if(this._alpha <= 0)
  585.                            {
  586.                               next_game();
  587.                               delete this.onEnterFrame;
  588.                            }
  589.                         }
  590.                      };
  591.                   }
  592.                }
  593.             }
  594.             else if(game_time < 10)
  595.             {
  596.                var _loc4_ = new Color(this.time10);
  597.                var _loc3_ = new Color(this.time1);
  598.                if(this.time_count % 2 == 0)
  599.                {
  600.                   _loc4_.setTransform(shine_Transform2);
  601.                   _loc3_.setTransform(shine_Transform2);
  602.                }
  603.                else
  604.                {
  605.                   _loc4_.setTransform(shine_Transform1);
  606.                   _loc3_.setTransform(shine_Transform1);
  607.                }
  608.             }
  609.          }
  610.       }
  611.    };
  612. }
  613. function win_game()
  614. {
  615.    bg.removeMovieClip();
  616.    game_ui.removeMovieClip();
  617.    play_music("music_win",true);
  618.    gotoAndStop("win");
  619. }
  620. function lose_game()
  621. {
  622.    bg.removeMovieClip();
  623.    game_ui.removeMovieClip();
  624.    play_music("music_lose",false);
  625.    music_lose.onSoundComplete = function()
  626.    {
  627.       play_music("music_op",true);
  628.    };
  629.    gotoAndStop("lose");
  630. }
  631. function init_control_btns(where)
  632. {
  633.    where.play_btn.gotoAndStop(1);
  634.    where.play_btn.onPress = function()
  635.    {
  636.       play_sound("button_sound");
  637.       this._y = this._y + 1;
  638.       if(monsters_exist > 0)
  639.       {
  640.          if(game_paused)
  641.          {
  642.             for(var _loc2_ in bg)
  643.             {
  644.                if(bg[_loc2_].living)
  645.                {
  646.                   if(bg[_loc2_].attack != undefined)
  647.                   {
  648.                      bg[_loc2_].mc.play();
  649.                   }
  650.                }
  651.             }
  652.             game_paused = false;
  653.             this.gotoAndStop(1);
  654.          }
  655.          else
  656.          {
  657.             for(_loc2_ in bg)
  658.             {
  659.                if(bg[_loc2_].living)
  660.                {
  661.                   if(bg[_loc2_].attack != undefined)
  662.                   {
  663.                      bg[_loc2_].mc.stop();
  664.                   }
  665.                }
  666.             }
  667.             game_paused = true;
  668.             this.gotoAndStop(2);
  669.          }
  670.       }
  671.    };
  672.    where.play_btn.onRelease = where.play_btn.onReleaseOutside = function()
  673.    {
  674.       this._y = this._y - 1;
  675.    };
  676.    if(game_music)
  677.    {
  678.       where.sound_btn.gotoAndStop(1);
  679.    }
  680.    else
  681.    {
  682.       where.sound_btn.gotoAndStop(2);
  683.    }
  684.    where.sound_btn.onPress = function()
  685.    {
  686.       play_sound("button_sound");
  687.       this._y = this._y + 1;
  688.       if(game_music)
  689.       {
  690.          game_music = false;
  691.          stopAllSounds();
  692.          this.gotoAndStop(2);
  693.       }
  694.       else
  695.       {
  696.          game_music = true;
  697.          music_resume = true;
  698.          play_music(now_music,true);
  699.          this.gotoAndStop(1);
  700.       }
  701.    };
  702.    where.sound_btn.onRelease = where.sound_btn.onReleaseOutside = function()
  703.    {
  704.       this._y = this._y - 1;
  705.    };
  706.    where.play_btn.enabled = false;
  707.    where.sound_btn.enabled = false;
  708. }
  709. function moveAction(who, xspeed, yspeed)
  710. {
  711.    if(who.yspeed == undefined)
  712.    {
  713.       who.yspeed = yspeed;
  714.    }
  715.    var _loc3_ = false;
  716.    if(who.yspeed >= 0)
  717.    {
  718.       if(who.cross_step > 0)
  719.       {
  720.          who.cross_step = who.cross_step - 1;
  721.       }
  722.       else if(who.living)
  723.       {
  724.          if(bg.step.hitTest(who._x,who._y + 15,true))
  725.          {
  726.             if(!bg.step.hitTest(who._x,who._y - 15,true))
  727.             {
  728.                _loc3_ = true;
  729.                adjustY(who,bg.step);
  730.             }
  731.          }
  732.       }
  733.       else if(bg.step.hitTest(who._x,who._y + 45,true))
  734.       {
  735.          if(!bg.step.hitTest(who._x,who._y + 15,true))
  736.          {
  737.             _loc3_ = true;
  738.             adjustY(who,bg.step);
  739.          }
  740.       }
  741.    }
  742.    if(_loc3_ and who.yspeed >= 0)
  743.    {
  744.       who.states = "stand";
  745.       delete who.yspeed;
  746.    }
  747.    if(!_loc3_ or who.yspeed < 0)
  748.    {
  749.       if(who.yspeed < 10)
  750.       {
  751.          who.yspeed += 0.75;
  752.       }
  753.       who._y += who.yspeed;
  754.       if(who._y > 400 + who._height)
  755.       {
  756.          who._y = 0;
  757.       }
  758.       who.states = "jump";
  759.    }
  760.    who.hit_ground = _loc3_;
  761.    var _loc4_ = false;
  762.    if(who.attack != undefined)
  763.    {
  764.       if(who.living)
  765.       {
  766.          if(bg.step.hitTest(who._x + xspeed,who._y - 15,true))
  767.          {
  768.             _loc4_ = true;
  769.          }
  770.       }
  771.       else if(bg.step.hitTest(who._x + xspeed,who._y,true))
  772.       {
  773.          _loc4_ = true;
  774.       }
  775.    }
  776.    if(_loc4_)
  777.    {
  778.       who.get_blocked();
  779.    }
  780.    else if(who.states == "stand")
  781.    {
  782.       if(who._x + xspeed > 20 and who._x + xspeed < 530)
  783.       {
  784.          who._x += xspeed;
  785.       }
  786.    }
  787.    else if(who._x + xspeed / 2 > 20 and who._x + xspeed / 2 < 530)
  788.    {
  789.       who._x += xspeed / 2;
  790.    }
  791.    who.hit_blocks = _loc4_;
  792.    if(who.living)
  793.    {
  794.       var _loc6_ = false;
  795.       if(bg.step.hitTest(who._x,who._y - 65,true))
  796.       {
  797.          if(!bg.step.hitTest(who._x,who._y - 85,true))
  798.          {
  799.             _loc6_ = true;
  800.          }
  801.       }
  802.       who.can_jump = _loc6_;
  803.       var _loc7_ = false;
  804.       if(bg.step.hitTest(who._x,who._y + 15,true))
  805.       {
  806.          if(!bg.step.hitTest(who._x,who._y + 30,true))
  807.          {
  808.             _loc7_ = true;
  809.          }
  810.       }
  811.       if(who._y < stage_down_max)
  812.       {
  813.          who.can_down = _loc7_;
  814.       }
  815.       var _loc5_ = false;
  816.       if(!bg.step.hitTest(who._x + xspeed,who._y + 15,true))
  817.       {
  818.          _loc5_ = true;
  819.       }
  820.       who.ahead_down = _loc5_;
  821.    }
  822.    if(who.attack != undefined)
  823.    {
  824.       if(who.living)
  825.       {
  826.          if(who.g.hitTest(bg.santa.g))
  827.          {
  828.             bg.santa.to_die();
  829.          }
  830.       }
  831.    }
  832. }
  833. function adjustY(who, where)
  834. {
  835.    if(who.living)
  836.    {
  837.       var _loc4_ = 0;
  838.    }
  839.    else
  840.    {
  841.       _loc4_ = 30;
  842.    }
  843.    var _loc2_ = 5;
  844.    while(_loc2_ >= 1)
  845.    {
  846.       if(!where.hitTest(who._x,who._y + _loc4_ + _loc2_ - 1,true))
  847.       {
  848.          who._y += _loc2_;
  849.       }
  850.       else
  851.       {
  852.          _loc2_ = _loc2_ - 1;
  853.       }
  854.    }
  855.    var _loc3_ = 5;
  856.    while(_loc3_ >= 1)
  857.    {
  858.       if(where.hitTest(who._x,who._y + _loc4_ - _loc3_,true))
  859.       {
  860.          who._y -= _loc3_;
  861.       }
  862.       else
  863.       {
  864.          _loc3_ = _loc3_ - 1;
  865.       }
  866.    }
  867. }
  868. function land_monsterAI(who)
  869. {
  870.    who.speed = -2;
  871.    who.states = "stand";
  872.    who.living = true;
  873.    who.turn = function()
  874.    {
  875.       if(this.states == "stand")
  876.       {
  877.          this.gotoAndStop("turn");
  878.          this.onEnterFrame = function()
  879.          {
  880.             if(!_root.game_paused)
  881.             {
  882.                if(this.mc._currentframe == this.mc._totalframes)
  883.                {
  884.                   this._xscale *= -1;
  885.                   this.move_me();
  886.                }
  887.             }
  888.          };
  889.       }
  890.    };
  891.    who.get_blocked = function()
  892.    {
  893.       if(this.living)
  894.       {
  895.          if(random(2))
  896.          {
  897.             this.jump(1);
  898.          }
  899.          else
  900.          {
  901.             this.turn();
  902.          }
  903.       }
  904.    };
  905.    who.jump = function(how)
  906.    {
  907.       this.gotoAndStop("jump");
  908.       if(how == -1)
  909.       {
  910.          this.onEnterFrame = function()
  911.          {
  912.             if(!_root.game_paused)
  913.             {
  914.                moveAction(this,0,-12);
  915.                if(who.states == "stand")
  916.                {
  917.                   create_land_snow(this);
  918.                   this.move_me();
  919.                }
  920.             }
  921.          };
  922.       }
  923.       else if(how == 1)
  924.       {
  925.          this.cross_step = 5;
  926.          this.onEnterFrame = function()
  927.          {
  928.             if(!_root.game_paused)
  929.             {
  930.                moveAction(this,0,1);
  931.                if(who.states == "stand")
  932.                {
  933.                   create_land_snow(this);
  934.                   this.move_me();
  935.                }
  936.             }
  937.          };
  938.       }
  939.    };
  940.    who.move_me = function()
  941.    {
  942.       this.gotoAndStop("walk");
  943.       if(!this.init)
  944.       {
  945.          this.init = true;
  946.          this._xscale = (1 - random(2) * 2) * 100;
  947.       }
  948.       this.onEnterFrame = function()
  949.       {
  950.          if(!_root.game_paused)
  951.          {
  952.             moveAction(this,this.speed * this._xscale / 100,0);
  953.             if(who._x + this.speed * this._xscale / 100 > stage_max)
  954.             {
  955.                who.turn();
  956.             }
  957.             else if(who._x + this.speed * this._xscale / 100 < stage_min)
  958.             {
  959.                who.turn();
  960.             }
  961.             else if(who.hit_blocks)
  962.             {
  963.                who.turn();
  964.             }
  965.             else if(who.ahead_down)
  966.             {
  967.                if(random(3))
  968.                {
  969.                   who.turn();
  970.                }
  971.             }
  972.             if(who.states == "stand")
  973.             {
  974.                if(!random(80))
  975.                {
  976.                   if(who.can_jump)
  977.                   {
  978.                      who.jump(-1);
  979.                   }
  980.                }
  981.                else if(!random(120))
  982.                {
  983.                   if(who.can_down)
  984.                   {
  985.                      who.jump(1);
  986.                   }
  987.                }
  988.                else if(!random(60))
  989.                {
  990.                   if(this.attack)
  991.                   {
  992.                      who.attacking();
  993.                   }
  994.                }
  995.             }
  996.          }
  997.       };
  998.    };
  999.    who.attacking = function()
  1000.    {
  1001.       this.gotoAndStop("attack");
  1002.       this.action_count = 0;
  1003.       this.onEnterFrame = function()
  1004.       {
  1005.          if(!_root.game_paused)
  1006.          {
  1007.             if(++this.action_count > 35)
  1008.             {
  1009.                this.move_me();
  1010.             }
  1011.             else if(who.mc.weapon.hitTest(bg.santa.g))
  1012.             {
  1013.                bg.santa.to_die();
  1014.             }
  1015.          }
  1016.       };
  1017.    };
  1018.    who.to_die = function()
  1019.    {
  1020.       if(this.living)
  1021.       {
  1022.          who.gotoAndStop("hit");
  1023.          who.freeze_count = 0;
  1024.          if(who.iceball == undefined)
  1025.          {
  1026.             who.attachMovie("iceball","iceball",this.getNextHighestDepth());
  1027.             who.iceball.gotoAndStop(1);
  1028.             who.onEnterFrame = function()
  1029.             {
  1030.                if(!_root.game_paused)
  1031.                {
  1032.                   if(this.living)
  1033.                   {
  1034.                      this.freeze_count = this.freeze_count + 1;
  1035.                      if(this.freeze_count == 100)
  1036.                      {
  1037.                         this.freeze_count = 0;
  1038.                         if(this.iceball._currentframe > 1)
  1039.                         {
  1040.                            this.iceball.prevFrame();
  1041.                            this.mc.play();
  1042.                         }
  1043.                         else
  1044.                         {
  1045.                            this.iceball.removeMovieClip();
  1046.                            this.move_me();
  1047.                         }
  1048.                      }
  1049.                   }
  1050.                }
  1051.             };
  1052.          }
  1053.          else if(game_power == 1)
  1054.          {
  1055.             if(who.iceball._currentframe < 5)
  1056.             {
  1057.                who.iceball.nextFrame();
  1058.             }
  1059.             else
  1060.             {
  1061.                who.iceball.gotoAndStop(6);
  1062.                who.mc.stop();
  1063.             }
  1064.          }
  1065.          else if(game_power == 2)
  1066.          {
  1067.             if(who.iceball._currentframe < 4)
  1068.             {
  1069.                who.iceball.gotoAndStop(who.iceball._currentframe + 3);
  1070.             }
  1071.             else
  1072.             {
  1073.                who.iceball.gotoAndStop(6);
  1074.                who.mc.stop();
  1075.             }
  1076.          }
  1077.       }
  1078.    };
  1079.    who.monster_dead = function()
  1080.    {
  1081.       monsters_exist--;
  1082.       var _loc4_ = bg.getNextHighestDepth();
  1083.       var _loc5_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc4_,_loc4_);
  1084.       _loc5_._x = this._x;
  1085.       _loc5_._y = this._y;
  1086.       create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
  1087.       var _loc3_ = random(this.type + 2) + 1;
  1088.       if(_loc3_ > 8)
  1089.       {
  1090.          _loc3_ = 8;
  1091.       }
  1092.       game_score += 100 * this.type;
  1093.       adjust_score(_root.game_ui);
  1094.       if(this.living)
  1095.       {
  1096.          add_presents(this,"presents",_loc3_);
  1097.       }
  1098.       this.removeMovieClip();
  1099.    };
  1100.    who.move_me();
  1101. }
  1102. function fly_monsterAI(who)
  1103. {
  1104.    who.speed = 1;
  1105.    who.states = "stand";
  1106.    who.living = true;
  1107.    who.turn = function()
  1108.    {
  1109.       this.gotoAndStop("turn");
  1110.       this.onEnterFrame = function()
  1111.       {
  1112.          if(!_root.game_paused)
  1113.          {
  1114.             if(this.mc._currentframe == this.mc._totalframes)
  1115.             {
  1116.                this._xscale *= -1;
  1117.                this.move_me();
  1118.             }
  1119.          }
  1120.       };
  1121.    };
  1122.    who.move_me = function()
  1123.    {
  1124.       this.gotoAndStop("walk");
  1125.       if(!this.init)
  1126.       {
  1127.          this.init = true;
  1128.          this._xscale = (1 - random(2) * 2) * 100;
  1129.       }
  1130.       this.onEnterFrame = function()
  1131.       {
  1132.          if(!_root.game_paused)
  1133.          {
  1134.             this._x += this.speed * (bg.santa._x - this._x) / Math.abs(bg.santa._x - this._x);
  1135.             this._y += this.speed * (bg.santa._y - this._y) / Math.abs(bg.santa._y - this._y);
  1136.             if(this._xscale == 100)
  1137.             {
  1138.                if(bg.santa._x - this._x > 5)
  1139.                {
  1140.                   this.turn();
  1141.                }
  1142.             }
  1143.             else if(this._xscale == -100)
  1144.             {
  1145.                if(bg.santa._x - this._x < 5)
  1146.                {
  1147.                   this.turn();
  1148.                }
  1149.             }
  1150.             if(this.g.hitTest(bg.santa.g))
  1151.             {
  1152.                bg.santa.to_die();
  1153.             }
  1154.             if(!random(60))
  1155.             {
  1156.                this.attacking();
  1157.             }
  1158.          }
  1159.       };
  1160.    };
  1161.    who.attacking = function()
  1162.    {
  1163.       this.gotoAndStop("attack");
  1164.       this.action_count = 0;
  1165.       this.onEnterFrame = function()
  1166.       {
  1167.          if(!_root.game_paused)
  1168.          {
  1169.             if(++this.action_count > 35)
  1170.             {
  1171.                this.move_me();
  1172.             }
  1173.             else if(who.mc.weapon.hitTest(bg.santa.g))
  1174.             {
  1175.                bg.santa.to_die();
  1176.             }
  1177.          }
  1178.       };
  1179.    };
  1180.    who.to_die = function()
  1181.    {
  1182.       if(this.living)
  1183.       {
  1184.          who.gotoAndStop("hit");
  1185.          who.freeze_count = 0;
  1186.          if(who.iceball == undefined)
  1187.          {
  1188.             who.attachMovie("iceball","iceball",this.getNextHighestDepth());
  1189.             who.iceball.gotoAndStop(1);
  1190.             who.onEnterFrame = function()
  1191.             {
  1192.                if(!_root.game_paused)
  1193.                {
  1194.                   if(this.living)
  1195.                   {
  1196.                      this.freeze_count = this.freeze_count + 1;
  1197.                      if(this.freeze_count == 100)
  1198.                      {
  1199.                         this.freeze_count = 0;
  1200.                         if(this.iceball._currentframe > 1)
  1201.                         {
  1202.                            this.iceball.prevFrame();
  1203.                            this.mc.play();
  1204.                         }
  1205.                         else
  1206.                         {
  1207.                            this.iceball.removeMovieClip();
  1208.                            this.move_me();
  1209.                         }
  1210.                      }
  1211.                   }
  1212.                }
  1213.             };
  1214.          }
  1215.          else if(game_power == 1)
  1216.          {
  1217.             if(who.iceball._currentframe < 5)
  1218.             {
  1219.                who.iceball.nextFrame();
  1220.             }
  1221.             else
  1222.             {
  1223.                who.iceball.gotoAndStop(6);
  1224.                who.mc.stop();
  1225.             }
  1226.          }
  1227.          else if(game_power == 2)
  1228.          {
  1229.             if(who.iceball._currentframe < 4)
  1230.             {
  1231.                who.iceball.gotoAndStop(who.iceball._currentframe + 3);
  1232.             }
  1233.             else
  1234.             {
  1235.                who.iceball.gotoAndStop(6);
  1236.                who.mc.stop();
  1237.             }
  1238.          }
  1239.       }
  1240.    };
  1241.    who.monster_dead = function()
  1242.    {
  1243.       monsters_exist--;
  1244.       var _loc4_ = bg.getNextHighestDepth();
  1245.       var _loc5_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc4_,_loc4_);
  1246.       _loc5_._x = this._x;
  1247.       _loc5_._y = this._y;
  1248.       create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
  1249.       var _loc3_ = random(this.type + 2) + 1;
  1250.       if(_loc3_ > 8)
  1251.       {
  1252.          _loc3_ = 8;
  1253.       }
  1254.       game_score += 100 * this.type;
  1255.       adjust_score(_root.game_ui);
  1256.       if(this.living)
  1257.       {
  1258.          add_presents(this,"presents",_loc3_);
  1259.       }
  1260.       this.removeMovieClip();
  1261.    };
  1262.    who.move_me();
  1263. }
  1264. function create_player()
  1265. {
  1266.    var _loc7_ = bg.getNextHighestDepth();
  1267.    var _loc5_ = bg.attachMovie("santa","santa",_loc7_);
  1268.    _loc5_._x = 75;
  1269.    _loc5_._y = 375;
  1270.    _loc5_.speed_rate = 0;
  1271.    _loc5_.living = true;
  1272.    _loc5_.unbreak = false;
  1273.    _loc5_.attack = true;
  1274.    _loc5_.to_die = function()
  1275.    {
  1276.       if(!this.unbreak)
  1277.       {
  1278.          game_life--;
  1279.          adjust_life(_root.game_ui);
  1280.          game_power = org_game_power;
  1281.          game_range = org_game_range;
  1282.          game_speed = org_game_speed;
  1283.          play_sound("santa_hit" + random(2));
  1284.          this.gotoAndStop("hit");
  1285.          unbreakAction(this);
  1286.          this.die_count = 0;
  1287.          this.onEnterFrame = function()
  1288.          {
  1289.             if(!_root.game_paused)
  1290.             {
  1291.                if(++this.die_count >= 20)
  1292.                {
  1293.                   this.die_count = 0;
  1294.                   if(game_life > 0)
  1295.                   {
  1296.                      this.gotoAndStop("stand");
  1297.                      this.doing = false;
  1298.                      this.gaming();
  1299.                   }
  1300.                   else
  1301.                   {
  1302.                      create_big_snow(this,4,8,100);
  1303.                      this.onEnterFrame = function()
  1304.                      {
  1305.                         if(!_root.game_paused)
  1306.                         {
  1307.                            this._alpha -= 3;
  1308.                            if(this._alpha <= 0)
  1309.                            {
  1310.                               next_game();
  1311.                               delete this.onEnterFrame;
  1312.                            }
  1313.                         }
  1314.                      };
  1315.                   }
  1316.                }
  1317.             }
  1318.          };
  1319.       }
  1320.    };
  1321.    _loc5_.to_die1 = function()
  1322.    {
  1323.       if(!this.unbreak)
  1324.       {
  1325.          adjust_life(_root.game_ui);
  1326.          game_power = org_game_power;
  1327.          game_range = org_game_range;
  1328.          game_speed = org_game_speed;
  1329.          play_sound("santa_hit" + random(2));
  1330.          this.gotoAndStop("hit");
  1331.          unbreakAction(this);
  1332.          this.die_count = 0;
  1333.          this.onEnterFrame = function()
  1334.          {
  1335.             if(!_root.game_paused)
  1336.             {
  1337.                if(++this.die_count >= 20)
  1338.                {
  1339.                   this.die_count = 0;
  1340.                   if(game_life > 0)
  1341.                   {
  1342.                      this.gotoAndStop("stand");
  1343.                      this.doing = false;
  1344.                      this.gaming();
  1345.                   }
  1346.                   else
  1347.                   {
  1348.                      create_big_snow(this,4,8,100);
  1349.                      this.onEnterFrame = function()
  1350.                      {
  1351.                         if(!_root.game_paused)
  1352.                         {
  1353.                            this._alpha -= 3;
  1354.                            if(this._alpha <= 0)
  1355.                            {
  1356.                               next_game();
  1357.                               delete this.onEnterFrame;
  1358.                            }
  1359.                         }
  1360.                      };
  1361.                   }
  1362.                }
  1363.             }
  1364.          };
  1365.       }
  1366.    };
  1367.    _loc5_.gaming = function()
  1368.    {
  1369.       this.onEnterFrame = function()
  1370.       {
  1371.          if(!_root.game_paused)
  1372.          {
  1373.             gameControl(this);
  1374.          }
  1375.       };
  1376.    };
  1377.    _loc5_.gaming();
  1378.    var _loc4_ = bg.step.Ma;
  1379.    var _loc6_ = _loc4_.length;
  1380.    monsters_exist = _loc6_;
  1381.    monster_all = monsters_exist;
  1382.    var _loc3_ = 0;
  1383.    while(_loc3_ < _loc6_)
  1384.    {
  1385.       create_monsters(_loc4_[_loc3_][0],_loc4_[_loc3_][1],_loc4_[_loc3_][2]);
  1386.       _loc3_ = _loc3_ + 1;
  1387.    }
  1388.    _loc7_ = bg.getNextHighestDepth();
  1389.    var _loc8_ = bg.attachMovie("show_levels","show_levels",_loc7_);
  1390.    _loc8_.stop();
  1391.    _loc8_.onEnterFrame = function()
  1392.    {
  1393.       if(next_stage == undefined)
  1394.       {
  1395.          this.play();
  1396.          delete this.onEnterFrame;
  1397.       }
  1398.    };
  1399. }
  1400. function unbreakAction(who)
  1401. {
  1402.    who.unbreak = true;
  1403.    if(game_life > 0)
  1404.    {
  1405.       var _loc4_ = who.createEmptyMovieClip("unbreakMC",who.getNextHighestDepth());
  1406.       _loc4_.unbreak_start = 0;
  1407.       _loc4_.onEnterFrame = function()
  1408.       {
  1409.          if(!_root.game_paused)
  1410.          {
  1411.             this.unbreak_start = this.unbreak_start + 1;
  1412.             var _loc3_ = this.unbreak_start % 10;
  1413.             if(_loc3_ < 5)
  1414.             {
  1415.                this._parent._alpha = 60;
  1416.             }
  1417.             else
  1418.             {
  1419.                this._parent._alpha = 100;
  1420.             }
  1421.             if(this.unbreak_start > 150)
  1422.             {
  1423.                this._parent._alpha = 100;
  1424.                this._parent.unbreak = false;
  1425.                this.removeMovieClip();
  1426.             }
  1427.          }
  1428.       };
  1429.    }
  1430. }
  1431. function gameControl(who)
  1432. {
  1433.    if(!who.get_hit)
  1434.    {
  1435.       if(Key.isDown(Acode))
  1436.       {
  1437.          key_AD_Action(who,-1);
  1438.       }
  1439.       else if(Key.isDown(Dcode))
  1440.       {
  1441.          key_AD_Action(who,1);
  1442.       }
  1443.       else
  1444.       {
  1445.          normalAction_AD(who);
  1446.       }
  1447.       if(Key.isDown(Jcode))
  1448.       {
  1449.          if(!Jcode_pressed)
  1450.          {
  1451.             Jcode_pressed = true;
  1452.             key_J_Action(who);
  1453.          }
  1454.       }
  1455.       else
  1456.       {
  1457.          Jcode_pressed = false;
  1458.       }
  1459.       if(Key.isDown(Wcode))
  1460.       {
  1461.          if(!Wcode_pressed)
  1462.          {
  1463.             Wcode_pressed = true;
  1464.             key_W_Action(who);
  1465.          }
  1466.       }
  1467.       else
  1468.       {
  1469.          Wcode_pressed = false;
  1470.          if(Key.isDown(Scode))
  1471.          {
  1472.             if(!Scode_pressed)
  1473.             {
  1474.                Scode_pressed = true;
  1475.                key_S_Action(who);
  1476.             }
  1477.          }
  1478.          else
  1479.          {
  1480.             Scode_pressed = false;
  1481.          }
  1482.       }
  1483.    }
  1484.    playerMove(who,game_speed * who.speed_rate,0);
  1485. }
  1486. function playerMove(who, xspeed, yspeed)
  1487. {
  1488.    if(who.yspeed == undefined)
  1489.    {
  1490.       who.yspeed = yspeed;
  1491.    }
  1492.    var _loc3_ = false;
  1493.    if(who.yspeed >= 0)
  1494.    {
  1495.       if(who.cross_step > 0)
  1496.       {
  1497.          who.cross_step = who.cross_step - 1;
  1498.       }
  1499.       else if(bg.step.hitTest(who._x,who._y + 15,true))
  1500.       {
  1501.          if(!bg.step.hitTest(who._x,who._y - 15,true))
  1502.          {
  1503.             _loc3_ = true;
  1504.             adjustY(who,bg.step);
  1505.          }
  1506.       }
  1507.    }
  1508.    if(_loc3_ and who.yspeed >= 0)
  1509.    {
  1510.       who.states = "stand";
  1511.       delete who.yspeed;
  1512.    }
  1513.    if(!_loc3_ or who.yspeed < 0)
  1514.    {
  1515.       who.states = "jump";
  1516.       if(who.yspeed < 10)
  1517.       {
  1518.          who.yspeed += 0.75;
  1519.       }
  1520.       who._y += who.yspeed;
  1521.       if(who._y > 400 + who._height)
  1522.       {
  1523.          who._y = 0;
  1524.       }
  1525.    }
  1526.    var _loc4_ = false;
  1527.    if(bg.step.hitTest(who._x + xspeed * 2,who._y,true))
  1528.    {
  1529.       if(bg.step.hitTest(who._x + xspeed,who._y - 30,true))
  1530.       {
  1531.          _loc4_ = true;
  1532.       }
  1533.    }
  1534.    if(!_loc4_)
  1535.    {
  1536.       if(who._x + xspeed > 10 and who._x + xspeed < 540)
  1537.       {
  1538.          who._x += xspeed;
  1539.       }
  1540.    }
  1541. }
  1542. function key_W_Action(who)
  1543. {
  1544.    if(who.states == "stand")
  1545.    {
  1546.       if(who._currentframe != 25)
  1547.       {
  1548.          who.doing = true;
  1549.          who.yspeed = -11;
  1550.          who.gotoAndStop("jump");
  1551.          play_sound("jump");
  1552.       }
  1553.    }
  1554. }
  1555. function key_S_Action(who)
  1556. {
  1557.    if(who._y < stage_down_max)
  1558.    {
  1559.       if(who.states == "stand")
  1560.       {
  1561.          if(who._currentframe != 25)
  1562.          {
  1563.             who.doing = true;
  1564.             who.cross_step = 5;
  1565.             who.yspeed = 1;
  1566.             who.gotoAndStop("jump");
  1567.             play_sound("jump");
  1568.          }
  1569.       }
  1570.    }
  1571. }
  1572. function key_AD_Action(who, dir)
  1573. {
  1574.    who._xscale = dir * 100;
  1575.    who.speed_rate = dir;
  1576.    if(!who.doing)
  1577.    {
  1578.       if(who.states == "stand")
  1579.       {
  1580.          if(who._currentframe != 9)
  1581.          {
  1582.             who.gotoAndStop("move");
  1583.          }
  1584.       }
  1585.       else if(who.states == "jump")
  1586.       {
  1587.          if(who._currentframe != 25)
  1588.          {
  1589.             who.gotoAndStop("jump");
  1590.          }
  1591.       }
  1592.    }
  1593. }
  1594. function normalAction_AD(who)
  1595. {
  1596.    who.speed_rate = 0;
  1597.    if(!who.doing)
  1598.    {
  1599.       if(who.states == "stand")
  1600.       {
  1601.          if(who._currentframe != 1)
  1602.          {
  1603.             create_land_snow(who,2);
  1604.             who.gotoAndStop("stand");
  1605.          }
  1606.       }
  1607.       else if(who.states == "jump")
  1608.       {
  1609.          if(who._currentframe != 25)
  1610.          {
  1611.             who.gotoAndStop("jump");
  1612.          }
  1613.       }
  1614.    }
  1615. }
  1616. function key_J_Action(who)
  1617. {
  1618.    var _loc2_ = false;
  1619.    for(var _loc3_ in bg)
  1620.    {
  1621.       if(bg[_loc3_].living)
  1622.       {
  1623.          if(bg[_loc3_].iceball._currentframe == 6)
  1624.          {
  1625.             if(bg[_loc3_].iceball.hitTest(who.g))
  1626.             {
  1627.                who.doing = true;
  1628.                who.gotoAndStop("kick");
  1629.                play_sound("santa_kick");
  1630.                create_big_snow(who,2,8,80);
  1631.                rollAction(bg[_loc3_],who._xscale / 100);
  1632.                _loc2_ = true;
  1633.                break;
  1634.             }
  1635.          }
  1636.       }
  1637.    }
  1638.    if(!_loc2_)
  1639.    {
  1640.       if(who._currentframe != 17)
  1641.       {
  1642.          who.doing = true;
  1643.          who.gotoAndStop("shoot");
  1644.       }
  1645.       else if(who.ready)
  1646.       {
  1647.          who.mc.gotoAndPlay(2);
  1648.       }
  1649.    }
  1650. }
  1651. function shootAction(where, point)
  1652. {
  1653.    play_sound("shoot_sound");
  1654.    var _loc4_ = bg.getNextHighestDepth();
  1655.    var _loc3_ = bg.attachMovie("shoot","shoot",_loc4_);
  1656.    _loc3_._xscale = where._xscale;
  1657.    _loc3_._x = get_map_point(point)[0];
  1658.    _loc3_._y = get_map_point(point)[1];
  1659.    if(game_power > 1)
  1660.    {
  1661.       _loc3_._xscale *= 1.5;
  1662.       _loc3_._yscale *= 1.5;
  1663.    }
  1664.    _loc3_.shoot_count = 0;
  1665.    _loc3_.xspeed = game_range;
  1666.    _loc3_.yspeed = 0;
  1667.    _loc3_.onEnterFrame = function()
  1668.    {
  1669.       if(!_root.game_paused)
  1670.       {
  1671.          if(this.can_go)
  1672.          {
  1673.             if(this._x < 0 or this._x > 550)
  1674.             {
  1675.                this.removeMovieClip();
  1676.             }
  1677.             else if(++this.shoot_count > 7)
  1678.             {
  1679.                if(this.shined)
  1680.                {
  1681.                   this.play();
  1682.                }
  1683.                else
  1684.                {
  1685.                   this.shined = true;
  1686.                   var _loc4_ = new Color(this);
  1687.                   _loc4_.setTransform(shine_Transform2);
  1688.                }
  1689.             }
  1690.             else
  1691.             {
  1692.                this.yspeed += 0.75;
  1693.                this._x += this.xspeed * this._xscale / 100;
  1694.                this._y += this.yspeed;
  1695.                this._rotation += this._xscale / 20;
  1696.                for(var _loc3_ in bg)
  1697.                {
  1698.                   if(bg[_loc3_].g.hitTest(this._x,this._y,true))
  1699.                   {
  1700.                      if(bg[_loc3_]._name != "santa")
  1701.                      {
  1702.                         bg[_loc3_].to_die();
  1703.                         create_big_snow(this,1,8,40);
  1704.                         this.removeMovieClip();
  1705.                         break;
  1706.                      }
  1707.                   }
  1708.                }
  1709.             }
  1710.          }
  1711.       }
  1712.    };
  1713. }
  1714. function rollAction(who, dir)
  1715. {
  1716.    if(who.living)
  1717.    {
  1718.       who.living = false;
  1719.       who.mc.stop();
  1720.       who.dir = dir;
  1721.       who.speed = 12;
  1722.       who.mc._y += 30;
  1723.       who.iceball._y += 30;
  1724.       who._y -= 30;
  1725.       who.hit_count = 0;
  1726.       who.kill_count = 0;
  1727.       who.explode = function()
  1728.       {
  1729.          this.mc._visible = 0;
  1730.          this.iceball.play();
  1731.          var _loc5_ = create_big_snow(this,4,10,80);
  1732.          if(monsters_exist <= 1)
  1733.          {
  1734.             _loc5_.myMission = function()
  1735.             {
  1736.                next_game();
  1737.             };
  1738.          }
  1739.          delete this.onEnterFrame;
  1740.          if(game_stage <= 4)
  1741.          {
  1742.             add_presents(this,"presents",8 + this.kill_count);
  1743.             if(this.kill_count >= monster_all - 1)
  1744.             {
  1745.                var _loc4_ = bg.attachMovie("presents","level_presents",bg.getNextHighestDepth());
  1746.                _loc4_._x = 275;
  1747.                _loc4_._y = -10;
  1748.                _loc4_.gotoAndStop("cbox");
  1749.                _loc4_.yspeed = 3;
  1750.                _loc4_.find_count = 0;
  1751.                _loc4_.show_score = function(which)
  1752.                {
  1753.                   var _loc3_ = 100000 + this.score;
  1754.                   var _loc4_ = this.score.toString().length;
  1755.                   if(which > _loc4_)
  1756.                   {
  1757.                      this["num" + which]._visible = 0;
  1758.                   }
  1759.                   else
  1760.                   {
  1761.                      var _loc5_ = Number(_loc3_.toString().slice(6 - which,7 - which));
  1762.                      this["num" + which].gotoAndStop(_loc5_ + 1);
  1763.                   }
  1764.                };
  1765.                _loc4_.onEnterFrame = function()
  1766.                {
  1767.                   if(!_root.game_paused)
  1768.                   {
  1769.                      if(this.hitTest(bg.santa.g))
  1770.                      {
  1771.                         game_score += Number(this.score);
  1772.                         adjust_score(_root.game_ui);
  1773.                         this.gotoAndStop("score");
  1774.                         play_sound("bonus_sound");
  1775.                         this.onEnterFrame = function()
  1776.                         {
  1777.                            if(!_root.game_paused)
  1778.                            {
  1779.                               this._y -= 2;
  1780.                               if(++this.find_count == 20)
  1781.                               {
  1782.                                  this.removeMovieClip();
  1783.                               }
  1784.                            }
  1785.                         };
  1786.                      }
  1787.                      else
  1788.                      {
  1789.                         this.yspeed += 1;
  1790.                         this._y += this.yspeed;
  1791.                         if(this._y > 275)
  1792.                         {
  1793.                            this.gotoAndStop("obox");
  1794.                            create_big_snow(this,2,5,50);
  1795.                            mission_end_count += 50;
  1796.                            var _loc3_ = 0;
  1797.                            while(_loc3_ <= 10)
  1798.                            {
  1799.                               add_presents(this,"presents",random(13) + 1);
  1800.                               _loc3_ = _loc3_ + 1;
  1801.                            }
  1802.                            this.onEnterFrame = function()
  1803.                            {
  1804.                               if(--this._alpha < 5)
  1805.                               {
  1806.                                  this.removeMovieClip();
  1807.                               }
  1808.                            };
  1809.                         }
  1810.                      }
  1811.                   }
  1812.                };
  1813.             }
  1814.          }
  1815.          else
  1816.          {
  1817.             add_presents(this,"presents",random(8) + 1);
  1818.          }
  1819.       };
  1820.       who.onEnterFrame = function()
  1821.       {
  1822.          if(!_root.game_paused)
  1823.          {
  1824.             moveAction(this,this.dir * this.speed,0);
  1825.             this._rotation += this.dir * 30;
  1826.             var _loc3_ = false;
  1827.             if(this.hit_blocks)
  1828.             {
  1829.                _loc3_ = true;
  1830.             }
  1831.             else if(this._x + this.dir * this.speed < 30)
  1832.             {
  1833.                _loc3_ = true;
  1834.             }
  1835.             else if(this._x + this.dir * this.speed > 520)
  1836.             {
  1837.                _loc3_ = true;
  1838.             }
  1839.             if(_loc3_)
  1840.             {
  1841.                this.dir *= -1;
  1842.                if(this._y > stage_down_max)
  1843.                {
  1844.                   this.hit_count += 3;
  1845.                }
  1846.                else
  1847.                {
  1848.                   this.hit_count = this.hit_count + 1;
  1849.                }
  1850.                play_sound("ball_hit");
  1851.             }
  1852.             if(this.hit_count >= 5)
  1853.             {
  1854.                this.explode();
  1855.             }
  1856.             else
  1857.             {
  1858.                for(var _loc4_ in bg)
  1859.                {
  1860.                   if(bg[_loc4_].attack != undefined and bg[_loc4_].living)
  1861.                   {
  1862.                      if(bg[_loc4_]._name != this._name and bg[_loc4_]._name != "santa")
  1863.                      {
  1864.                         if(bg[_loc4_].g.hitTest(this.iceball))
  1865.                         {
  1866.                            bg[_loc4_].monster_dead();
  1867.                            play_sound("ball_crash");
  1868.                            if(bg[_loc4_].typ != "boss")
  1869.                            {
  1870.                               this.kill_count = this.kill_count + 1;
  1871.                            }
  1872.                            else
  1873.                            {
  1874.                               this.explode();
  1875.                            }
  1876.                            break;
  1877.                         }
  1878.                      }
  1879.                   }
  1880.                }
  1881.             }
  1882.          }
  1883.       };
  1884.    }
  1885. }
  1886. function get_map_point(which)
  1887. {
  1888.    if(which != undefined)
  1889.    {
  1890.       var _loc1_ = new Object();
  1891.       _loc1_.x = which._x;
  1892.       _loc1_.y = which._y;
  1893.       which._parent.localToGlobal(_loc1_);
  1894.       var _loc2_ = [];
  1895.       _loc2_[0] = _loc1_.x;
  1896.       _loc2_[1] = _loc1_.y;
  1897.       return _loc2_;
  1898.    }
  1899. }
  1900. function bossAI1(who)
  1901. {
  1902.    who.states = "stand";
  1903.    who.living = true;
  1904.    who.xspeed = -6;
  1905.    who.blood = game_boss1_health;
  1906.    who.attack = true;
  1907.    who.typ = "boss";
  1908.    who.turn = function()
  1909.    {
  1910.       this.xspeed *= -1;
  1911.    };
  1912.    who.get_blocked = function()
  1913.    {
  1914.       if(this.living)
  1915.       {
  1916.          this.turn();
  1917.       }
  1918.    };
  1919.    who.stand = function()
  1920.    {
  1921.       this.gotoAndStop("stand");
  1922.       this.action_count = 0;
  1923.       this.onEnterFrame = function()
  1924.       {
  1925.          if(!_root.game_paused)
  1926.          {
  1927.             if(++this.action_count == 30)
  1928.             {
  1929.                if(monsters_exist <= 1)
  1930.                {
  1931.                   this.summon();
  1932.                }
  1933.                else if(!random(2))
  1934.                {
  1935.                   this.move_me();
  1936.                }
  1937.                else
  1938.                {
  1939.                   this.jump();
  1940.                }
  1941.             }
  1942.          }
  1943.       };
  1944.    };
  1945.    who.jump = function()
  1946.    {
  1947.       this.gotoAndStop("jump");
  1948.       this.cross_step = 25;
  1949.       this.onEnterFrame = function()
  1950.       {
  1951.          if(!_root.game_paused)
  1952.          {
  1953.             moveAction(this,0,-20);
  1954.             if(this.states == "stand")
  1955.             {
  1956.                create_land_snow(this);
  1957.                if(!random(2))
  1958.                {
  1959.                   this.move_me();
  1960.                }
  1961.                else
  1962.                {
  1963.                   this.stand();
  1964.                }
  1965.             }
  1966.          }
  1967.       };
  1968.    };
  1969.    who.move_me = function()
  1970.    {
  1971.       this.gotoAndStop("walk");
  1972.       this.action_count = 0;
  1973.       this.onEnterFrame = function()
  1974.       {
  1975.          if(!_root.game_paused)
  1976.          {
  1977.             moveAction(this,this.xspeed,0);
  1978.             if(this._x + this.xspeed > stage_max)
  1979.             {
  1980.                this.turn();
  1981.             }
  1982.             else if(this._x + this.xspeed < stage_min)
  1983.             {
  1984.                this.turn();
  1985.             }
  1986.             else if(this.hit_blocks)
  1987.             {
  1988.                this.turn();
  1989.             }
  1990.             if(this.states == "stand")
  1991.             {
  1992.                if(++this.action_count == 150)
  1993.                {
  1994.                   this.stand();
  1995.                }
  1996.             }
  1997.          }
  1998.       };
  1999.    };
  2000.    who.summon = function()
  2001.    {
  2002.       this.gotoAndStop("summon");
  2003.       this.action_count = 0;
  2004.       create_monsters(random(3) + 1,90,-100 - random(100));
  2005.       create_monsters(random(3) + 1,270,-100 - random(100));
  2006.       create_monsters(random(3) + 1,450,-100 - random(100));
  2007.       monsters_exist += 3;
  2008.       monster_all = monsters_exist;
  2009.       this.onEnterFrame = function()
  2010.       {
  2011.          if(!_root.game_paused)
  2012.          {
  2013.             if(++this.action_count > 50)
  2014.             {
  2015.                if(!random(2))
  2016.                {
  2017.                   this.move_me();
  2018.                }
  2019.                else
  2020.                {
  2021.                   this.jump();
  2022.                }
  2023.             }
  2024.          }
  2025.       };
  2026.    };
  2027.    who.monster_dead = function()
  2028.    {
  2029.       delete this.onEnterFrame;
  2030.       if(--this.blood > 0)
  2031.       {
  2032.          this.action_count = 0;
  2033.          this.gotoAndStop("hit");
  2034.          this.onEnterFrame = function()
  2035.          {
  2036.             if(!_root.game_paused)
  2037.             {
  2038.                if(++this.action_count > 30)
  2039.                {
  2040.                   this.move_me();
  2041.                }
  2042.             }
  2043.          };
  2044.       }
  2045.       else
  2046.       {
  2047.          monsters_exist--;
  2048.          boss_all_kill();
  2049.          mission_end_count += 50;
  2050.          var _loc3_ = 0;
  2051.          while(_loc3_ <= 10)
  2052.          {
  2053.             add_presents(this,"presents",random(13) + 1);
  2054.             _loc3_ = _loc3_ + 1;
  2055.          }
  2056.          this.gotoAndStop("die");
  2057.       }
  2058.       _root["game_boss" + game_level + "_health"] = this.blood;
  2059.       adjust_boss(_root.game_ui);
  2060.    };
  2061.    who.stand();
  2062. }
  2063. function boss_all_kill()
  2064. {
  2065.    play_music("music_win",true);
  2066.    for(var _loc1_ in bg)
  2067.    {
  2068.       if(bg[_loc1_].typ != "boss")
  2069.       {
  2070.          if(bg[_loc1_]._name != "santa")
  2071.          {
  2072.             if(bg[_loc1_].attack != undefined)
  2073.             {
  2074.                if(bg[_loc1_].living)
  2075.                {
  2076.                   bg[_loc1_].monster_dead();
  2077.                }
  2078.             }
  2079.          }
  2080.       }
  2081.    }
  2082. }
  2083. function bossAI2(who)
  2084. {
  2085.    who.states = "stand";
  2086.    who.living = true;
  2087.    who.xspeed = -3;
  2088.    who.blood = game_boss2_health;
  2089.    who.attack = true;
  2090.    who.typ = "boss";
  2091.    who.turn = function()
  2092.    {
  2093.       this.xspeed *= -1;
  2094.    };
  2095.    who.get_blocked = function()
  2096.    {
  2097.       if(this.living)
  2098.       {
  2099.          this.turn();
  2100.       }
  2101.    };
  2102.    who.stand = function()
  2103.    {
  2104.       this.gotoAndStop("stand");
  2105.       this.action_count = 0;
  2106.       this.onEnterFrame = function()
  2107.       {
  2108.          if(!_root.game_paused)
  2109.          {
  2110.             if(++this.action_count == 30)
  2111.             {
  2112.                if(monsters_exist <= 1)
  2113.                {
  2114.                   this.summon();
  2115.                }
  2116.                else if(!random(2))
  2117.                {
  2118.                   this.move_me();
  2119.                }
  2120.                else
  2121.                {
  2122.                   this.attacking();
  2123.                }
  2124.             }
  2125.          }
  2126.       };
  2127.    };
  2128.    who.move_me = function()
  2129.    {
  2130.       this.gotoAndStop("walk");
  2131.       this.onEnterFrame = function()
  2132.       {
  2133.          if(!_root.game_paused)
  2134.          {
  2135.             moveAction(this,this.xspeed,0);
  2136.             if(this._x + this.xspeed > stage_max - 50)
  2137.             {
  2138.                this.turn();
  2139.             }
  2140.             else if(this._x + this.xspeed < stage_min + 50)
  2141.             {
  2142.                this.turn();
  2143.             }
  2144.             else if(this.hit_blocks)
  2145.             {
  2146.                this.turn();
  2147.             }
  2148.             if(this.states == "stand")
  2149.             {
  2150.                if(Math.abs(this._x - bg.santa._x) < 20)
  2151.                {
  2152.                   this.attacking();
  2153.                }
  2154.                else if(!random(250))
  2155.                {
  2156.                   this.stand();
  2157.                }
  2158.             }
  2159.          }
  2160.       };
  2161.    };
  2162.    who.attacking = function()
  2163.    {
  2164.       this.gotoAndStop("attack");
  2165.       this.action_count = 0;
  2166.       this.onEnterFrame = function()
  2167.       {
  2168.          if(!_root.game_paused)
  2169.          {
  2170.             if(++this.action_count > 43)
  2171.             {
  2172.                this.stand();
  2173.             }
  2174.          }
  2175.       };
  2176.    };
  2177.    who.attackAction = function()
  2178.    {
  2179.       var _loc4_ = bg.getNextHighestDepth();
  2180.       var _loc3_ = bg.attachMovie("iceball","boss2iceball_" + _loc4_,_loc4_);
  2181.       _loc3_._x = this._x;
  2182.       _loc3_._y = this._y - 80;
  2183.       _loc3_.gotoAndStop(4);
  2184.       _loc3_.onEnterFrame = function()
  2185.       {
  2186.          if(!_root.game_paused)
  2187.          {
  2188.             if(this.hitTest(bg.santa.g))
  2189.             {
  2190.                bg.santa.to_die();
  2191.                this.gotoAndPlay(7);
  2192.                delete this.onEnterFrame;
  2193.             }
  2194.             this._y += 25;
  2195.             if(this._y > 500)
  2196.             {
  2197.                this.removeMovieClip();
  2198.             }
  2199.          }
  2200.       };
  2201.    };
  2202.    who.summon = function()
  2203.    {
  2204.       this.gotoAndStop("summon");
  2205.       this.action_count = 0;
  2206.       create_monsters(random(5) + 1,34,58);
  2207.       create_monsters(random(5) + 1,516,58);
  2208.       create_monsters(random(5) + 1,108,130);
  2209.       create_monsters(random(5) + 1,443,130);
  2210.       monsters_exist += 4;
  2211.       monster_all = monsters_exist;
  2212.       this.onEnterFrame = function()
  2213.       {
  2214.          if(!_root.game_paused)
  2215.          {
  2216.             if(++this.action_count > 44)
  2217.             {
  2218.                this.stand();
  2219.             }
  2220.          }
  2221.       };
  2222.    };
  2223.    who.monster_dead = function()
  2224.    {
  2225.       delete this.onEnterFrame;
  2226.       if(--this.blood > 0)
  2227.       {
  2228.          this.action_count = 0;
  2229.          this.gotoAndStop("hit");
  2230.          this.onEnterFrame = function()
  2231.          {
  2232.             if(!_root.game_paused)
  2233.             {
  2234.                if(++this.action_count > 30)
  2235.                {
  2236.                   this.move_me();
  2237.                }
  2238.             }
  2239.          };
  2240.       }
  2241.       else
  2242.       {
  2243.          monsters_exist--;
  2244.          boss_all_kill();
  2245.          mission_end_count += 50;
  2246.          var _loc3_ = 0;
  2247.          while(_loc3_ <= 10)
  2248.          {
  2249.             add_presents(this,"presents",random(13) + 1);
  2250.             _loc3_ = _loc3_ + 1;
  2251.          }
  2252.          this.gotoAndStop("die");
  2253.       }
  2254.       _root["game_boss" + game_level + "_health"] = this.blood;
  2255.       adjust_boss(_root.game_ui);
  2256.    };
  2257.    who.stand();
  2258. }
  2259. function bossAI3(who)
  2260. {
  2261.    who.states = "stand";
  2262.    who.living = true;
  2263.    who.blood = game_boss3_health;
  2264.    who.attack = true;
  2265.    who.typ = "boss";
  2266.    who.stand_array = [[275,123],[72,103],[485,103]];
  2267.    who.stand = function()
  2268.    {
  2269.       this.gotoAndStop("stand");
  2270.       this.action_count = 0;
  2271.       this.onEnterFrame = function()
  2272.       {
  2273.          if(!_root.game_paused)
  2274.          {
  2275.             if(++this.action_count == 50)
  2276.             {
  2277.                if(monsters_exist <= 1)
  2278.                {
  2279.                   this.summon();
  2280.                }
  2281.                else
  2282.                {
  2283.                   this.kiss();
  2284.                }
  2285.             }
  2286.          }
  2287.       };
  2288.    };
  2289.    who.kiss = function()
  2290.    {
  2291.       this.gotoAndStop("attack");
  2292.       this.action_count = 0;
  2293.       this.onEnterFrame = function()
  2294.       {
  2295.          if(!_root.game_paused)
  2296.          {
  2297.             if(this.g.hitTest(bg.santa.g))
  2298.             {
  2299.                bg.santa.to_die();
  2300.             }
  2301.             if(++this.action_count > 35)
  2302.             {
  2303.                this.move_me();
  2304.             }
  2305.          }
  2306.       };
  2307.    };
  2308.    who.move_me = function()
  2309.    {
  2310.       this.gotoAndStop("fly");
  2311.       if(this.attack)
  2312.       {
  2313.          this.target_x = bg.santa._x;
  2314.          this.target_y = bg.santa._y + 15;
  2315.          this.onEnterFrame = function()
  2316.          {
  2317.             if(!_root.game_paused)
  2318.             {
  2319.                this._x += (this.target_x - this._x) / 20;
  2320.                this._y += (this.target_y - this._y) / 20;
  2321.                if(this.g.hitTest(bg.santa.g))
  2322.                {
  2323.                   bg.santa.to_die();
  2324.                }
  2325.                if(Math.abs(this.target_y - this._y) < 5)
  2326.                {
  2327.                   this.attack = false;
  2328.                   this.move_me();
  2329.                }
  2330.             }
  2331.          };
  2332.       }
  2333.       else
  2334.       {
  2335.          var _loc3_ = this.stand_array[random(3)];
  2336.          this.target_x = _loc3_[0];
  2337.          this.target_y = _loc3_[1];
  2338.          this.onEnterFrame = function()
  2339.          {
  2340.             if(!_root.game_paused)
  2341.             {
  2342.                this._x += (this.target_x - this._x) / 20;
  2343.                this._y += (this.target_y - this._y) / 20;
  2344.                if(this.g.hitTest(bg.santa.g))
  2345.                {
  2346.                   bg.santa.to_die();
  2347.                }
  2348.                if(Math.abs(this.target_x - this._x) < 5)
  2349.                {
  2350.                   if(Math.abs(this.target_y - this._y) < 5)
  2351.                   {
  2352.                      this.attack = true;
  2353.                      this.stand();
  2354.                   }
  2355.                }
  2356.             }
  2357.          };
  2358.       }
  2359.    };
  2360.    who.summon = function()
  2361.    {
  2362.       this.gotoAndStop("summon");
  2363.       this.action_count = 0;
  2364.       create_monsters(random(6) + 1,90,230 + random(120));
  2365.       create_monsters(random(6) + 1,180,230 + random(120));
  2366.       create_monsters(random(6) + 1,270,230 + random(120));
  2367.       create_monsters(random(6) + 1,360,230 + random(120));
  2368.       create_monsters(random(6) + 1,450,230 + random(120));
  2369.       monsters_exist += 5;
  2370.       monster_all = monsters_exist;
  2371.       this.onEnterFrame = function()
  2372.       {
  2373.          if(!_root.game_paused)
  2374.          {
  2375.             if(++this.action_count > 50)
  2376.             {
  2377.                this.stand();
  2378.             }
  2379.          }
  2380.       };
  2381.    };
  2382.    who.monster_dead = function()
  2383.    {
  2384.       delete this.onEnterFrame;
  2385.       if(--this.blood > 0)
  2386.       {
  2387.          this.action_count = 0;
  2388.          this.gotoAndStop("hit");
  2389.          this.onEnterFrame = function()
  2390.          {
  2391.             if(!_root.game_paused)
  2392.             {
  2393.                if(++this.action_count > 30)
  2394.                {
  2395.                   this.attack = false;
  2396.                   this.move_me();
  2397.                }
  2398.             }
  2399.          };
  2400.       }
  2401.       else
  2402.       {
  2403.          monsters_exist--;
  2404.          boss_all_kill();
  2405.          mission_end_count += 50;
  2406.          var _loc3_ = 0;
  2407.          while(_loc3_ <= 10)
  2408.          {
  2409.             add_presents(this,"presents",random(13) + 1);
  2410.             _loc3_ = _loc3_ + 1;
  2411.          }
  2412.          this.gotoAndStop("die");
  2413.       }
  2414.       _root["game_boss" + game_level + "_health"] = this.blood;
  2415.       adjust_boss(_root.game_ui);
  2416.    };
  2417.    who.stand();
  2418. }
  2419. function bossAI4(who)
  2420. {
  2421.    who.states = "stand";
  2422.    who.living = true;
  2423.    who.blood = game_boss4_health;
  2424.    who.attack = true;
  2425.    who.typ = "boss";
  2426.    who.stand = function()
  2427.    {
  2428.       this.gotoAndStop("stand");
  2429.       this.action_count = 0;
  2430.       this.onEnterFrame = function()
  2431.       {
  2432.          if(!_root.game_paused)
  2433.          {
  2434.             if(++this.action_count == 50)
  2435.             {
  2436.                if(monsters_exist <= 1)
  2437.                {
  2438.                   this.summon();
  2439.                }
  2440.                else if(!random(2))
  2441.                {
  2442.                   this.move_me();
  2443.                }
  2444.                else
  2445.                {
  2446.                   this.tracing();
  2447.                }
  2448.             }
  2449.          }
  2450.       };
  2451.    };
  2452.    who.move_me = function()
  2453.    {
  2454.       this.gotoAndStop("move");
  2455.       this.action_count = 0;
  2456.       this.onEnterFrame = function()
  2457.       {
  2458.          if(!_root.game_paused)
  2459.          {
  2460.             this.action_count = this.action_count + 1;
  2461.             if(this.action_count == 5)
  2462.             {
  2463.                this._alpha = 40;
  2464.             }
  2465.             else if(this.action_count == 15)
  2466.             {
  2467.                this._alpha = 0;
  2468.                this._x = random(450) + 50;
  2469.                this._y = random(200) + 150;
  2470.             }
  2471.             else if(this.action_count == 20)
  2472.             {
  2473.                this._alpha = 40;
  2474.             }
  2475.             else if(this.action_count == 30)
  2476.             {
  2477.                this._alpha = 100;
  2478.                this.stand();
  2479.             }
  2480.          }
  2481.       };
  2482.    };
  2483.    who.tracing = function()
  2484.    {
  2485.       this.gotoAndStop("trace");
  2486.       this.onEnterFrame = function()
  2487.       {
  2488.          if(!_root.game_paused)
  2489.          {
  2490.             if(this.g.hitTest(bg.santa.g))
  2491.             {
  2492.                bg.santa.to_die();
  2493.             }
  2494.             this._x += (bg.santa._x - this._x) / 20;
  2495.             this._y += (bg.santa._y - 120 - this._y) / 20;
  2496.             if(Math.abs(bg.santa._x - this._x) < 5)
  2497.             {
  2498.                this.attacking();
  2499.             }
  2500.          }
  2501.       };
  2502.    };
  2503.    who.attacking = function()
  2504.    {
  2505.       this.gotoAndStop("attack");
  2506.       this.action_count = 0;
  2507.       var _loc4_ = bg.getNextHighestDepth();
  2508.       this.mother_mc = bg.createEmptyMovieClip("boss4iceball",_loc4_);
  2509.       this.mother_mc._x = this._x;
  2510.       this.mother_mc._y = this._y - 100;
  2511.       this.mother_mc.attachMovie("iceball","iceball_1",1);
  2512.       this.mother_mc.iceball_1._x = -50;
  2513.       this.mother_mc.iceball_1.gotoAndStop(5);
  2514.       this.mother_mc.attachMovie("iceball","iceball_2",2);
  2515.       this.mother_mc.iceball_2._x = 50;
  2516.       this.mother_mc.iceball_2.gotoAndStop(5);
  2517.       var _loc3_ = new Color(this.mother_mc);
  2518.       _loc3_.setTransform(shine_Transform2);
  2519.       this.mother_mc._xscale = 10;
  2520.       this.mother_mc._yscale = 10;
  2521.       this.mother_mc.onEnterFrame = function()
  2522.       {
  2523.          if(!_root.game_paused)
  2524.          {
  2525.             if(this._xscale > 100)
  2526.             {
  2527.                this._xscale = 100;
  2528.                var _loc3_ = new Color(this);
  2529.                _loc3_.setTransform(shine_Transform1);
  2530.                this.onEnterFrame = function()
  2531.                {
  2532.                   if(!_root.game_paused)
  2533.                   {
  2534.                      if(this.hitTest(bg.santa.g))
  2535.                      {
  2536.                         bg.santa.to_die();
  2537.                         this.iceball_1.gotoAndPlay(7);
  2538.                         this.iceball_2.gotoAndPlay(7);
  2539.                         this.onEnterFrame = function()
  2540.                         {
  2541.                            if(!_root.game_paused)
  2542.                            {
  2543.                               if(this.iceball_1 == undefined)
  2544.                               {
  2545.                                  this.removeMovieClip();
  2546.                               }
  2547.                            }
  2548.                         };
  2549.                      }
  2550.                   }
  2551.                   this._y += 10;
  2552.                   if(this._y > 500)
  2553.                   {
  2554.                      this.removeMovieClip();
  2555.                   }
  2556.                };
  2557.             }
  2558.             this._xscale += 10;
  2559.             this._yscale += 10;
  2560.          }
  2561.       };
  2562.       this.onEnterFrame = function()
  2563.       {
  2564.          if(!_root.game_paused)
  2565.          {
  2566.             this.action_count = this.action_count + 1;
  2567.             if(this.action_count > 32)
  2568.             {
  2569.                this.stand();
  2570.             }
  2571.          }
  2572.       };
  2573.    };
  2574.    who.summon = function()
  2575.    {
  2576.       this.gotoAndStop("summon");
  2577.       this.action_count = 0;
  2578.       create_monsters(random(8) + 1,60 + random(160),225);
  2579.       create_monsters(random(8) + 1,340 + random(160),225);
  2580.       monsters_exist += 2;
  2581.       monster_all = monsters_exist;
  2582.       this.onEnterFrame = function()
  2583.       {
  2584.          if(!_root.game_paused)
  2585.          {
  2586.             if(++this.action_count > 25)
  2587.             {
  2588.                this.stand();
  2589.             }
  2590.          }
  2591.       };
  2592.    };
  2593.    who.revenge = function()
  2594.    {
  2595.       this.gotoAndStop("revenge");
  2596.       this.action_count = 0;
  2597.       this.onEnterFrame = function()
  2598.       {
  2599.          if(!_root.game_paused)
  2600.          {
  2601.             if(++this.action_count > 81)
  2602.             {
  2603.                this.stand();
  2604.             }
  2605.          }
  2606.       };
  2607.    };
  2608.    who.revenging = function()
  2609.    {
  2610.       if(random(2))
  2611.       {
  2612.          var _loc6_ = 110;
  2613.          var _loc8_ = 0;
  2614.          var _loc7_ = 5;
  2615.       }
  2616.       else
  2617.       {
  2618.          _loc6_ = 50;
  2619.          _loc8_ = 1;
  2620.          _loc7_ = 10;
  2621.       }
  2622.       var _loc5_ = _loc8_;
  2623.       while(_loc5_ <= _loc7_)
  2624.       {
  2625.          var _loc4_ = bg.getNextHighestDepth();
  2626.          var _loc3_ = bg.attachMovie("monsterboss4_weapon","monsterboss4_weapon" + _loc4_,_loc4_);
  2627.          _loc3_._x = _loc6_ * _loc5_;
  2628.          _loc3_._y = -80 - random(150);
  2629.          _loc3_.gotoAndStop(4);
  2630.          _loc3_.onEnterFrame = function()
  2631.          {
  2632.             if(!_root.game_paused)
  2633.             {
  2634.                if(!this.attacked)
  2635.                {
  2636.                   if(this.hitTest(bg.santa.g))
  2637.                   {
  2638.                      this.attacked = true;
  2639.                      bg.santa.to_die();
  2640.                   }
  2641.                }
  2642.                this._y += 15;
  2643.                if(this._y > 500)
  2644.                {
  2645.                   this.removeMovieClip();
  2646.                }
  2647.             }
  2648.          };
  2649.          _loc5_ = _loc5_ + 1;
  2650.       }
  2651.    };
  2652.    who.monster_dead = function()
  2653.    {
  2654.       this._alpha = 100;
  2655.       delete this.onEnterFrame;
  2656.       if(--this.blood > 0)
  2657.       {
  2658.          this.action_count = 0;
  2659.          this.gotoAndStop("hit");
  2660.          this.onEnterFrame = function()
  2661.          {
  2662.             if(!_root.game_paused)
  2663.             {
  2664.                if(++this.action_count > 30)
  2665.                {
  2666.                   this.revenge();
  2667.                }
  2668.             }
  2669.          };
  2670.       }
  2671.       else
  2672.       {
  2673.          monsters_exist--;
  2674.          boss_all_kill();
  2675.          mission_end_count += 50;
  2676.          var _loc3_ = 0;
  2677.          while(_loc3_ <= 30)
  2678.          {
  2679.             add_presents(this,"presents",random(13) + 1);
  2680.             _loc3_ = _loc3_ + 1;
  2681.          }
  2682.          this.gotoAndStop("die");
  2683.       }
  2684.       _root["game_boss" + game_level + "_health"] = this.blood;
  2685.       adjust_boss(_root.game_ui);
  2686.    };
  2687.    who.stand();
  2688. }
  2689. function play_music(what, cyc)
  2690. {
  2691.    if(this[what] == undefined)
  2692.    {
  2693.       this[what] = new Sound();
  2694.       this[what].attachSound(what);
  2695.    }
  2696.    if(game_music)
  2697.    {
  2698.       if(now_music != what or music_resume)
  2699.       {
  2700.          now_music = what;
  2701.          music_resume = false;
  2702.          stopAllSounds();
  2703.          if(!cyc)
  2704.          {
  2705.             this[what].start();
  2706.          }
  2707.          else
  2708.          {
  2709.             this[what].start(0,999999);
  2710.          }
  2711.       }
  2712.    }
  2713. }
  2714. function play_sound(what)
  2715. {
  2716.    if(this[what] == undefined)
  2717.    {
  2718.       this[what] = new Sound();
  2719.       this[what].attachSound(what);
  2720.    }
  2721.    if(game_music)
  2722.    {
  2723.       this[what].stop(what);
  2724.       this[what].start();
  2725.    }
  2726. }
  2727. stop();
  2728. var bb = 6;
  2729. _root.wudi.gotoAndStop(2);
  2730. var v = 6;
  2731. arr = [75,75,74];
  2732. arr2 = [75,76,87];
  2733. arr3 = [76,87,76,87];
  2734. mmm = 0;
  2735. this.createEmptyMovieClip("mc1",getNextHighestDepth());
  2736. this.createEmptyMovieClip("mc2",getNextHighestDepth());
  2737. this.createEmptyMovieClip("mc3",getNextHighestDepth());
  2738. var key_func1 = new key_func(arr2,ob1,ob2,mc2,func,300);
  2739. var key_func2 = new key_func(arr,ob3,ob4,mc1,func_2,300);
  2740. var key_func3 = new key_func(arr3,ob5,ob6,mc3,func_3,300);
  2741. Key_obj = {};
  2742. Key_obj.num = 0;
  2743. Key_obj.onKeyDown = function()
  2744. {
  2745.    this.btn_blo = true;
  2746. };
  2747. Key_obj.onKeyUp = function()
  2748. {
  2749.    this.btn_blo = false;
  2750. };
  2751. Key.addListener(Key_obj);
  2752. if(game_mask == undefined)
  2753. {
  2754.    _root.attachMovie("game_mask","game_mask",1000);
  2755.    _root.setMask(game_mask);
  2756. }
  2757. btns.btn01.onPress = function()
  2758. {
  2759.    play_sound("button_sound");
  2760. };
  2761. btns.btn01.onRelease = function()
  2762. {
  2763.    next_round();
  2764. };
  2765. btns.btn02.onPress = function()
  2766. {
  2767.    play_sound("button_sound");
  2768. };
  2769. btns.btn02.onRelease = function()
  2770. {
  2771.    help.play();
  2772. };
  2773. play_music("music_op",true);
  2774. snow_down(bg);
  2775. _root.score = 0;
  2776. game_score = 0;
  2777. Stage.scaleMode = "noScale";
  2778. myMenu = new ContextMenu();
  2779. myMenu.hideBuiltInItems();
  2780. _root.menu = myMenu;
  2781. getURL("FSCommand:trapallkeys",true);
  2782. game_paused = true;
  2783. game_music = true;
  2784. music_resume = false;
  2785. game_level = 1;
  2786. game_stage = 0;
  2787. stage_max = 525;
  2788. stage_min = 25;
  2789. stage_down_max = 325;
  2790. monsters_exist = 0;
  2791. monster_all = 0;
  2792. game_score = 0;
  2793. game_life = 10;
  2794. game_power = org_game_power = 1;
  2795. game_range = org_game_range = 12;
  2796. game_speed = org_game_speed = 4;
  2797. game_boss1_health = 5;
  2798. game_boss2_health = 8;
  2799. game_boss3_health = 8;
  2800. game_boss4_health = 10;
  2801. game_time = 60;
  2802. shine_Transform1 = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  2803. shine_Transform2 = {ra:0,rb:255,ga:0,gb:255,ba:0,bb:255,aa:100,ab:0};
  2804. Acode = org_Acode = 65;
  2805. Dcode = org_Dcode = 68;
  2806. Wcode = org_Wcode = 87;
  2807. Scode = org_Scode = 83;
  2808. Jcode = org_Jcode = 85;
  2809.